package test;

import org.quartz.JobKey;

import redis.clients.jedis.ShardedJedis;
import test.redis.JedisUtil;

public class HoldManager {
	
	public static boolean hold(JobKey jobKey ){
		ShardedJedis resource = JedisUtil.pool.getResource();
		Long setnx = resource.setnx(jobKey.toString(), jobKey.toString());
		resource.close();
		return setnx==1?true:false;
	}
	
	public static void release(JobKey jobKey){
		ShardedJedis resource = JedisUtil.pool.getResource();
		resource.del(jobKey.toString());
		resource.close();
	}
	
	public static void outlook(){
		
	}
	
}
